home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 8605 / 8605.xpi / chrome / content / alert.js < prev    next >
Text File  |  2009-07-06  |  12KB  |  309 lines

  1. function deviantAnywhereNotifier()
  2. {
  3.     this.finalHeight;
  4.     this.heightSoFar=0;
  5.  
  6.     this.animTime = 15;
  7.     this.showTime = 5000;
  8.  
  9.     this.closeTimer;
  10.     this.shouldAutoClose = true;
  11. }
  12.  
  13. deviantAnywhereNotifier.prototype =
  14. {
  15.     mouseIn: function()
  16.     {
  17.         this.shouldAutoClose = false;
  18.         clearTimeout(this.closeTimer);
  19.     },
  20.  
  21.     mouseOut: function(event)
  22.     {
  23.         this.shouldAutoClose = true;
  24.         closeTimer = setTimeout("ro_cvds_dANotifier.animClose()",this.showTime/2);
  25.     },
  26.  
  27.     initNotifier: function()
  28.     {
  29.  
  30.         this.initContent()
  31.         sizeToContent();
  32.         this.finalHeight = window.outerHeight;
  33.         window.outerHeight = 0;
  34.         window.moveTo(screen.availLeft + screen.availWidth - window.outerWidth, screen.availHeight - window.outerHeight);
  35.         setTimeout("ro_cvds_dANotifier.animOpen()",this.animTime);
  36.     },
  37.  
  38.     initContent: function()
  39.     {
  40.         o = window.opener
  41.  
  42.         notifyContent = document.getElementById("notificationContent");
  43.  
  44.  
  45.         label = document.createElement("label");
  46.         label.setAttribute("id","title");
  47.         label.setAttribute("value","deviantAnywhere");
  48.         notifyContent.appendChild(label);
  49.  
  50.         items = o.ro_cvds_daInstance.prev_deviations;
  51.         for(f=0;f<items.length;f++)
  52.         {
  53.             box = document.createElement("box");
  54.             box.setAttribute("class","entry deviation");
  55.  
  56.             label1 = document.createElement("label");
  57.             label1.setAttribute("value",items[f][0]);
  58.             label1.setAttribute("class","text-link");
  59.             label1.setAttribute("href",items[f][1]);
  60.             label1.setAttribute("onclick","window.opener.openURL(this.getAttribute('href'),true);return false;");
  61.             box.appendChild(label1);
  62.  
  63.             label2 = document.createElement("label");
  64.             label2.setAttribute("value","submitted deviation");
  65.             box.appendChild(label2);
  66.  
  67.             label3 = document.createElement("label");
  68.             label3.setAttribute("value",items[f][2]);
  69.             label3.setAttribute("class","text-link");
  70.             label3.setAttribute("href",items[f][3]);
  71.             label3.setAttribute("onclick","window.opener.openURL(this.getAttribute('href'),true);return false;");
  72.             box.appendChild(label3);
  73.  
  74.             notifyContent.appendChild(box);
  75.         }
  76.  
  77.         items = o.ro_cvds_daInstance.prev_notes;
  78.         for(f=0;f<items.length;f++)
  79.         {
  80.             box = document.createElement("box");
  81.             box.setAttribute("class","entry note");
  82.  
  83.             label1 = document.createElement("label");
  84.             label1.setAttribute("value",items[f][0]);
  85.             label1.setAttribute("class","text-link");
  86.             label1.setAttribute("href",items[f][1]);
  87.             label1.setAttribute("onclick","window.opener.openURL(this.getAttribute('href'),true);return false;");
  88.             box.appendChild(label1);
  89.  
  90.             label2 = document.createElement("label");
  91.             label2.setAttribute("value","sent you the note");
  92.             box.appendChild(label2);
  93.  
  94.             label3 = document.createElement("label");
  95.             label3.setAttribute("value",items[f][2]);
  96.             label3.setAttribute("class","text-link");
  97.             label3.setAttribute("href",items[f][3]);
  98.             label3.setAttribute("onclick","window.opener.openURL(this.getAttribute('href'),true);return false;");
  99.             box.appendChild(label3);
  100.  
  101.             notifyContent.appendChild(box);
  102.         }
  103.  
  104.         items = o.ro_cvds_daInstance.prev_favs;
  105.         for(f=0;f<items.length;f++)
  106.         {
  107.             box = document.createElement("box");
  108.             box.setAttribute("class","entry fav");
  109.  
  110.             label1 = document.createElement("label");
  111.             label1.setAttribute("value",items[f][0]);
  112.             label1.setAttribute("class","text-link");
  113.             label1.setAttribute("href",items[f][1]);
  114.             label1.setAttribute("onclick","window.opener.openURL(this.getAttribute('href'),true);return false;");
  115.             box.appendChild(label1);
  116.  
  117.             label2 = document.createElement("label");
  118.             label2.setAttribute("value","has added");
  119.             box.appendChild(label2);
  120.  
  121.             label3 = document.createElement("label");
  122.             label3.setAttribute("value",items[f][2]);
  123.             label3.setAttribute("class","text-link");
  124.             label3.setAttribute("href",items[f][3]);
  125.             label3.setAttribute("onclick","window.opener.openURL(this.getAttribute('href'),true);return false;");
  126.             box.appendChild(label3);
  127.  
  128.             label4 = document.createElement("label");
  129.             label4.setAttribute("value","to their");
  130.             box.appendChild(label4);
  131.  
  132.             label5 = document.createElement("label");
  133.             label5.setAttribute("value",items[f][4]);
  134.             label5.setAttribute("class","text-link");
  135.             label5.setAttribute("href",items[f][5]);
  136.             label5.setAttribute("onclick","window.opener.openURL(this.getAttribute('href'),true);return false;");
  137.             box.appendChild(label5);
  138.  
  139.             notifyContent.appendChild(box);
  140.         }
  141.  
  142.         items = o.ro_cvds_daInstance.prev_watch;
  143.         for(f=0;f<items.length;f++)
  144.         {
  145.             box = document.createElement("box");
  146.             box.setAttribute("class","entry watch");
  147.  
  148.             label1 = document.createElement("label");
  149.             label1.setAttribute("value",items[f][0]);
  150.             label1.setAttribute("class","text-link");
  151.             label1.setAttribute("href",items[f][1]);
  152.             label1.setAttribute("onclick","window.opener.openURL(this.getAttribute('href'),true);return false;");
  153.             box.appendChild(label1);
  154.  
  155.             label2 = document.createElement("label");
  156.             label2.setAttribute("value","has added you to their deviantWATCH");
  157.             box.appendChild(label2);
  158.  
  159.             notifyContent.appendChild(box);
  160.         }
  161.  
  162.         items = o.ro_cvds_daInstance.prev_comments;
  163.         for(f=0;f<items.length;f++)
  164.         {
  165.             box = document.createElement("box");
  166.             box.setAttribute("class","entry message");
  167.  
  168.             label1 = document.createElement("label");
  169.             label1.setAttribute("value",items[f][0]);
  170.             label1.setAttribute("class","text-link");
  171.             label1.setAttribute("href",items[f][1]);
  172.             label1.setAttribute("onclick","window.opener.openURL(this.getAttribute('href'),true);return false;");
  173.             box.appendChild(label1);
  174.  
  175.             label2 = document.createElement("label");
  176.             label2.setAttribute("value","posted a");
  177.             box.appendChild(label2);
  178.  
  179.             label3 = document.createElement("label");
  180.             label3.setAttribute("value","comment");
  181.             label3.setAttribute("class","text-link");
  182.             label3.setAttribute("href",items[f][4]);
  183.             label3.setAttribute("onclick","window.opener.openURL(this.getAttribute('href'),true);return false;");
  184.             box.appendChild(label3);
  185.  
  186.             label4 = document.createElement("label");
  187.             label4.setAttribute("value","on");
  188.             box.appendChild(label4);
  189.  
  190.             label5 = document.createElement("label");
  191.             label5.setAttribute("value",items[f][2]);
  192.             label5.setAttribute("class","text-link");
  193.             label5.setAttribute("href",items[f][3]);
  194.             label5.setAttribute("onclick","window.opener.openURL(this.getAttribute('href'),true);return false;");
  195.             box.appendChild(label5);
  196.  
  197.             notifyContent.appendChild(box);
  198.         }
  199.  
  200.         items = o.ro_cvds_daInstance.prev_critiques;
  201.         for(f=0;f<items.length;f++)
  202.         {
  203.             box = document.createElement("box");
  204.             box.setAttribute("class","entry critique");
  205.  
  206.             label1 = document.createElement("label");
  207.             label1.setAttribute("value",items[f][0]);
  208.             label1.setAttribute("class","text-link");
  209.             label1.setAttribute("href",items[f][1]);
  210.             label1.setAttribute("onclick","window.opener.openURL(this.getAttribute('href'),true);return false;");
  211.             box.appendChild(label1);
  212.  
  213.             label2 = document.createElement("label");
  214.             label2.setAttribute("value","posted a");
  215.             box.appendChild(label2);
  216.  
  217.             label3 = document.createElement("label");
  218.             label3.setAttribute("value","critique");
  219.             label3.setAttribute("class","text-link");
  220.             label3.setAttribute("href",items[f][2]);
  221.             label3.setAttribute("onclick","window.opener.openURL(this.getAttribute('href'),true);return false;");
  222.             box.appendChild(label3);
  223.  
  224.             label4 = document.createElement("label");
  225.             label4.setAttribute("value","of");
  226.             box.appendChild(label4);
  227.  
  228.             label5 = document.createElement("label");
  229.             label5.setAttribute("value",items[f][4]);
  230.             label5.setAttribute("class","text-link");
  231.             label5.setAttribute("href",items[f][3]);
  232.             label5.setAttribute("onclick","window.opener.openURL(this.getAttribute('href'),true);return false;");
  233.             box.appendChild(label5);
  234.  
  235.             label6 = document.createElement("label");
  236.             label6.setAttribute("value","by");
  237.             box.appendChild(label6);
  238.  
  239.             label7 = document.createElement("label");
  240.             label7.setAttribute("value",items[f][5]);
  241.             label7.setAttribute("class","text-link");
  242.             label7.setAttribute("href",items[f][6]);
  243.             label7.setAttribute("onclick","window.opener.openURL(this.getAttribute('href'),true);return false;");
  244.             box.appendChild(label7);
  245.  
  246.  
  247.             notifyContent.appendChild(box);
  248.         }
  249.  
  250.         items = o.ro_cvds_daInstance.prev_journals;
  251.         for(f=0;f<items.length;f++)
  252.         {
  253.             box = document.createElement("box");
  254.             box.setAttribute("class","entry journal");
  255.  
  256.             label1 = document.createElement("label");
  257.             label1.setAttribute("value",items[f][0]);
  258.             label1.setAttribute("class","text-link");
  259.             label1.setAttribute("href",items[f][1]);
  260.             label1.setAttribute("onclick","window.opener.openURL(this.getAttribute('href'),true);return false;");
  261.             box.appendChild(label1);
  262.  
  263.             label2 = document.createElement("label");
  264.             label2.setAttribute("value","wrote journal entry");
  265.             box.appendChild(label2);
  266.  
  267.             label3 = document.createElement("label");
  268.             label3.setAttribute("value",items[f][2]);
  269.             label3.setAttribute("class","text-link");
  270.             label3.setAttribute("href",items[f][3]);
  271.             label3.setAttribute("onclick","window.opener.openURL(this.getAttribute('href'),true);return false;");
  272.             box.appendChild(label3);
  273.  
  274.             notifyContent.appendChild(box);
  275.         }
  276.  
  277.  
  278.     },
  279.  
  280.     animOpen: function()
  281.     {
  282.         if (this.heightSoFar<this.finalHeight)
  283.         {
  284.             window.screenY -= 1 - screen.availTop;
  285.             this.heightSoFar++;
  286.             window.outerHeight = this.heightSoFar;
  287.             setTimeout("ro_cvds_dANotifier.animOpen()",this.animTime);
  288.         }
  289.         else
  290.             if (this.shouldAutoClose)
  291.                 closeTimer = setTimeout("ro_cvds_dANotifier.animClose()",this.showTime);
  292.     },
  293.  
  294.     animClose: function()
  295.     {
  296.         if (this.heightSoFar>0)
  297.         {
  298.             this.heightSoFar--;
  299.             window.screenY += 1 + screen.availTop;
  300.             window.outerHeight = this.heightSoFar;
  301.             setTimeout("ro_cvds_dANotifier.animClose()",this.animTime);
  302.         }
  303.         else
  304.             window.close();
  305.     }
  306. }
  307.  
  308. ro_cvds_dANotifier = new deviantAnywhereNotifier();
  309.